home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / do-eve1r / gradient.bas < prev    next >
BASIC Source File  |  1999-07-11  |  2KB  |  80 lines

  1. Attribute VB_Name = "gradient"
  2. Function GRAD(frm As Form, COLOR As String, Direction As String, c1 As Long, c2 As Long) As Boolean
  3.  
  4.  
  5.     '
  6.     '
  7.     ' Easy Gradients In VB - Code by: TjB R.a.d @ www.alcoholabusecen
  8.     '     ter.com
  9.     ' use the code where and how you want just stop by and say "HI!"
  10.     '
  11.     '
  12.     '
  13.     ' Simple Color - Red,Green,Blue
  14.     ' Direction - Fill Direction "Up" or "Down"
  15.     ' c1 - Color Modifier 1
  16.     ' c2 - color Modifier 2
  17.     '
  18.     ' By messing with c1 and c2 you can get some very cool results...
  19.     '     .
  20.     ' here are some of my favorites......
  21.     '
  22.     ' COLOR c1c2
  23.     ' ---------------------------------
  24.     ' RED15761
  25.     ' BLUE301949
  26.     ' BLUE279161
  27.     ' BLUE634208
  28.     ' BLUE187584
  29.     ' BLUE81458
  30.     ' BLUE23544
  31.     ' BLUE543157
  32.     ' green 939655
  33.     ' green 108784
  34.     ' green 19211
  35.     ' green 74106
  36.     '
  37.     GRAD = True
  38.     COLOR = UCase(COLOR)
  39.     Direction = UCase(Direction)
  40.     If Direction = "UP" Then X1 = 255: X2 = 0: X3 = -0.5
  41.     If Direction = "DOWN" Then X1 = 0: X2 = 255: X3 = 0.5
  42.     If Direction <> "UP" And Direction <> "DOWN" Then GRAD = False: GoTo ed
  43.     MDS = frm.DrawStyle
  44.     MDW = frm.DrawWidth
  45.     MSM = frm.ScaleMode
  46.     MSH = frm.ScaleHeight
  47.     frm.DrawStyle = vbInsideSolid
  48.     frm.DrawWidth = 2
  49.     frm.ScaleMode = vbPixels
  50.     frm.ScaleHeight = 256
  51.  
  52.  
  53.     For x = X1 To X2 Step X3
  54.  
  55.  
  56.         Select Case COLOR
  57.             
  58.             Case "RED"
  59.             frm.Line (0, x)-(frm.Width, x + 1), RGB(255 - x, c1, c2), B
  60.             Case "GREEN"
  61.             frm.Line (0, x)-(frm.Width, x + 1), RGB(c1, 255 - x, c2), B
  62.             Case "BLUE"
  63.             frm.Line (0, x)-(frm.Width, x + 1), RGB(c1, c2, 255 - x), B
  64.             Case Else
  65.             GRAD = False
  66.         End Select
  67.  
  68. Next x
  69.  
  70.  
  71. frm.DrawStyle = MDS
  72. frm.DrawWidth = MDW
  73. frm.ScaleHeight = MSH
  74. frm.ScaleMode = MSM
  75. ed:
  76. End Function
  77.  
  78.  
  79.  
  80.